import pandas as pd

s1 = pd.Series(data=["java", "shujia", "python"], index=[1, 2, 3])

print(s1[2])
print(s1.values)
print(s1.index)

data = {
    "name": ["张三", "李四", "王五"],
    "age": [23, 32, 24]
}

df = pd.DataFrame(data=data)

print(df)
print(df["name"])  # 返回一个Series
print("*" * 100)
# del df["name"]
print(df)

print(df["age"] > 23)

print(df[df["age"] > 23])
print("*" * 100)
print(df.describe())
print("*" * 100)
student = pd.read_csv("student.txt", sep=",", header=None, names=["id", "name", "age", "gender", "clazz"],
                      encoding="utf-8")

print(student["age"])
print(student[student["age"] > 23])

agedf = student[student["age"] > 23]

agedf.to_csv("age.txt", index=False, header=False)

print(df.head())
